package edu.gdit.health.dao;

import edu.gdit.health.model.TemperatureStatisticsModel;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author Lemon-7
 * @create 2021-05-15 10:05
 */

@Mapper
@Repository

public interface TemperatureStatisticsDao {

    @Select("select count(*) value,\n" +
            "   (\n" +
            "       case temperature\n" +
            "            when 'HIGH' then '高热 39℃以上'\n" +
            "            when 'LOW' then '低热 37.3-37.9℃'\n" +
            "            when 'NORMAL' then '正常 37.3℃ 以下'\n" +
            "            when 'MIDDLE' then '中热 38-39℃'\n" +
            "       end\n" +
            "   ) name\n" +
            "from sys_report\n" +
            "where temperature\n" +
            "          in ('HIGH','LOW','NORMAL','MIDDLE')\n" +
            "Group by temperature;")
    List<TemperatureStatisticsModel> getStatistics();

}
